package models

import (
	"time"

	"gorm.io/gorm"
)

type BaseModel struct {
	ID        uint           `gorm:"primaryKey" json:"id"`
	CreatedAt time.Time      `json:"createdAt"`
	UpdatedAt time.Time      `json:"updatedAt"`
	DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
}

type DocCategory struct {
	BaseModel
	Name      string    `json:"name"`
	Documents []DocItem `json:"documents"`
}

type DocItem struct {
	BaseModel
	Title         string `gorm:"size:200;not null"`
	Content       string `gorm:"type:text"`
	Author        string `gorm:"size:100"`
	Slug          string `gorm:"size:200;uniqueIndex"`
	DocCategoryID uint
	SEO           SEO         `gorm:"embedded"`
	Category      DocCategory `gorm:"foreignKey:DocCategoryID"`
}
